package com.panshi.controller;

import com.panshi.api.util.PageSizeVO;
import com.panshi.pojo.TypeVO;
import com.panshi.servers.TypeServers;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;

import javax.websocket.server.PathParam;
import java.util.List;

/**
 * @author XiaoWangYa
 * @version 1.0
 * @date 2020/8/1 0001 下午 3:17 17
 */
@Controller
@Slf4j
@ApiModel("口腔分类Controller层")
public class TypeController {

    @Autowired
    private TypeServers yb_typeServers;

    @PostMapping("/addType")
    @ResponseBody
    @ApiOperation("口腔分类 add")
    public String addTypeInfo (@RequestBody TypeVO yb_Type_VO) {
        log.info("新增了口腔分类 --> " + yb_Type_VO);
        yb_typeServers.addTypeInfo(yb_Type_VO);
        return "ok";
    }

    @PostMapping("/deleteType/{id}")
    @ResponseBody
    @ApiOperation("口腔分类 delete")
    public String deleteTypeInfo(@PathVariable String id) {
        log.info("口腔分类 delete --> " + id);
        yb_typeServers.deleteTypeInfo(id);
        return "ok";
    }

    @PostMapping("/queryTypeInfoAll")
    @ResponseBody
    @ApiOperation("查询分类 query")
    public List<TypeVO> queryTypeInfoAll() {
        log.info("查询分类");
        return yb_typeServers.queryTypeInfoAll();
    }

    @PostMapping("/queryArticleInfoAll")
    @ResponseBody
    @ApiOperation("咨询分类 query")
    public List<TypeVO> queryArticleInfoAll() {
        log.info("查询咨询分类");
        return yb_typeServers.queryArticleInfoAll();
    }

    @PostMapping("/queryAnswerInfoAll")
    @ResponseBody
    @ApiOperation("回答分类 query")
    public List<TypeVO> queryAnswerInfoAll() {
        log.info("查询回答分类");
        return yb_typeServers.queryAnswerInfoAll();
    }

    @PostMapping("/updateType")
    @ResponseBody
    @ApiOperation("口腔分类 update")
    public String updateTypeInfo (@RequestBody TypeVO yb_Type_VO) {
        log.info("修改了口腔分类 --> " + yb_Type_VO);
        yb_typeServers.updateTypeInfo(yb_Type_VO);
        return "ok";
    }

}

